<%@page contentType="text/html;charset=utf-8"%>
<%@taglib uri="/struts-tags"  prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>生成订单 - 当当网</title>
		<link href="../css/login.css" rel="stylesheet" type="text/css" />
		<link href="../css/page_bottom.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../js/jquery.js"></script>
		<script type="text/javascript">
			$(function(){
				$("#address").change(function(){
					var address=$("#address>option:selected").attr("value");
					if(address!=-1){
						$.getJSON(
							"inputAddress!getSelectedAddress.action?time="+new Date().getTime(),
							{"address.id":address},
							function(json){
								$("#addressId").val(json.id);
								$("#receiveName").val(json.receive_name);
								$("#fullAddress").val(json.full_address);
								$("#postalCode").val(json.postal_code);
								$("#phone").val(json.phone);
								$("#mobile").val(json.mobile);
							}
						)
					}else{
						$("#addressId").val(-1);
						$("#receiveName").val("");
						$("#fullAddress").val("");
						$("#postalCode").val("");
						$("#phone").val("");
						$("#mobile").val("");
					}
				});
			});
		</script>
		
	</head>
	<body>	
		<%@include file="../common/head1.jsp"%>
		<div class="login_step">
			生成订单骤: 1.确认订单 &gt;
			<span class="red_bold"> 2.填写送货地址</span>  &gt; 3.订单成功
		</div>
		<div class="fill_message">
			<p>
				选择地址：
				<s:select list="addresses" id="address" listKey="id" listValue="full_address" headerKey="-1" headerValue="填写新地址">
				</s:select>
			</p>
			<s:form name="ctl00" method="post" action="processOrder" id="f" theme="simple">
				<s:token></s:token>
				<s:hidden name="address.id" id="addressId" value="-1"></s:hidden>
				<table class="tab_login">
					<tr>
						<td valign="top" class="w1">
							收件人姓名：
						</td>
						<td>
							<s:textfield name="address.receive_name" id="receiveName" cssClass="text_input"></s:textfield>
							<div class="text_left" id="nameValidMsg">
								<p>
									请填写有效的收件人姓名<br/>
									<span id="errName" class="infoError"><s:property value="errors['address.name']"/></span>
								</p>
							</div>
						</td>
					</tr>
					<tr>
						<td valign="top" class="w1">
							收件人详细地址：
						</td>
						<td>
							<s:textfield name="address.full_address" id="fullAddress" cssClass="text_input"></s:textfield>
							<div class="text_left" id="addressValidMsg">
								<p>
									请填写有效的收件人的详细地址<br/>
									<span id="errAddress" class="infoError"><s:property value="errors['address.fullAddress']"/></span>
								</p>
							</div>
						</td>
					</tr>
					<tr>
						<td valign="top" class="w1">
							邮政编码
						</td>
						<td>
								<s:textfield name="address.postal_code" id="postalCode" cssClass="text_input"></s:textfield>
							<div class="text_left" id="codeValidMsg">
								<p>
									请填写有效的收件人的邮政编码<br/>
									<span id="errPost" class="infoError"><s:property value="errors['address.postalCode']"/></span>
								</p>
							</div>
						</td>
					</tr>
					<tr>
						<td valign="top" class="w1">
							电话
						</td>
						<td>
							<s:textfield name="address.phone" id="phone" cssClass="text_input"></s:textfield>
							<div class="text_left" id="phoneValidMsg">
								<p>
									请填写有效的收件人的电话<br/>
									<span id="errPhone" class="infoError"><s:property value="errors['address.phone']"/></span>
								</p>
							</div>
						</td>
					</tr>
					<tr>
						<td valign="top" class="w1">
							手机
						</td>
						<td>
							<s:textfield name="address.mobile" id="mobile" cssClass="text_input"></s:textfield>
							<div class="text_left" id="mobileValidMsg">
								<p>
									请填写有效的收件人的手机<br/>
									<span id="errMobile" class="infoError"><s:property value="errors['address.mobile']"/></span>
								</p>
							</div>
						</td>
					</tr>
				</table>

				<div class="login_in">

					<input id="btnClientRegister" class="button_1" name="submit"
						type="button" value="取消"  onclick="location='../main/bookList.action'"/>
					<s:submit id="btnClientRegister" cssClass="button_1" name="submit" value="下一步"></s:submit>
				</div>
			</s:form>
		</div>
		<%@include file="../common/foot1.jsp"%>
	</body>
</html>

